
package com.lbs.core.shared.tables;

import java.io.Serializable;
/**
 * Clase que representa un par de: Llave-Valor.
 * 
 * 04/Noviembre/2011
 * 
 * @author Alberto Sandoval Sotelo
 * 
 *
 */
public class LbsKeyValuePair implements Serializable{


	private static final long serialVersionUID = 1L;
	private String key;
	private LbsAbstractValue value;
	
	
	LbsKeyValuePair(){}
	
	LbsKeyValuePair(String k, Object v){
		key=k;
		setValue(v);
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (key != null ? key.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof LbsKeyValuePair)) {
            return false;
        }
        LbsKeyValuePair other = (LbsKeyValuePair) object;
        if ((this.key == null && other.key != null) || (this.key != null && !this.key.equals(other.key))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "[" + key + "="+ value.getValue() +"]";
    }
	
	
	public String getKey() {
		return key;
	}

	public Object getValue() {
		return value.getValue();
	}

	public void setValue(Object v) {
			value=LbsAbstractValue.getInstance(v);
	}
}
